<!DOCTYPE html>
<html lang="pt-BR">
    <head>
        <?php
        session_start();
        include_once'bloco/head.php';
        include_once '../control/conexao.php';
        include_once '../control/valida_sessao.php';

        function __autoload($classe) {
            include_once"../model/{$classe}.class.php";
        }
        ?>
        <link href="bootstrap/css/morris.css" rel="stylesheet">
    </head>
    <body>      
        <div id="wrapper">
            <?php
            include_once'bloco/navbar.php';
            include_once '../control/valida_perfil.php';
            ?>
            <div id="page-wrapper">
                <?php include_once 'bloco/banner.php'; ?>                  
                <div class="row">
                    <div class=" panel panel-success">
                        <div class="panel-heading">
                            <p class="panel-title"><i class = "glyphicon glyphicon-th-large"></i> Consultar Processo</p>
                        </div>
                        <div class="panel-body">
                            <div class="col-md-6 col-md-offset-3">
                                <div class="alert alert-success alert-dismissable">
                                    <table class="table table-condensed table-responsive">
                                        <?php
                                        $processo = new processo();
                                        $processo->id_processo = $_GET['processo'];
                                        $processoDAO = new processoDAO();
                                        $processo = $processoDAO->consultar($processo);
                                        ?>
                                        <tr>
                                            <td><strong>Matricula do Aluno</strong></td>
                                            <td><?php echo $processo->matricula ?></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Processo N°</strong></td>
                                            <td><?php echo $processo->id_processo ?></td>
                                        </tr>
                                        <?php
                                        $consulta_status = mysql_query("SELECT * FROM status WHERE id_status='$processo->id_status'");
                                        $status = mysql_result($consulta_status, 0, 'status_nome');
                                        ?>
                                        <tr>
                                            <td><strong>Status</strong></td>
                                            <td><?php echo utf8_encode($status) ?></td>                                        
                                        </tr>                                        
                                        <tr>
                                            <td><strong>Vaga N°</strong></td>
                                            <td><a href="exibir_vaga.php?id_vaga=<?php echo $processo->id_vaga ?>"><?php echo $processo->id_vaga ?></a></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Data de Inicio</strong></td>
                                            <td><?php echo $processo->data_inicio ?></td>                                        
                                        </tr>
                                        <tr>
                                            <td><strong>Data de Finalização</strong></td>
                                            <td><?php echo $processo->data_fim ?></td>                                        
                                        </tr>
                                        <tr>
                                            <td><strong>Observação</strong></td>
                                            <td><?php echo utf8_encode($processo->observacao) ?></td>                                        
                                        </tr>
                                    </table>
                                    <?php
                                    if ($_SESSION['usuario']->id_perfil == 3) {
                                        $id_usuario = $_SESSION['usuario']->id_usuario;
                                        $id_curso = mysql_result(mysql_query("SELECT id_curso FROM aluno WHERE id_usuario='$id_usuario'"), 0, 'id_curso');
                                        switch ($id_curso) {
                                            case 1: {
                                                    $link = 'documentos/informatica.zip';
                                                    break;
                                                }
                                            case 2: {
                                                    $link = 'documentos/eletronica.zip';
                                                    break;
                                                }
                                            case 3: {
                                                    $link = 'documentos/telecom.zip';
                                                    break;
                                                }
                                            case 4: {
                                                    $link = 'documentos/eletrotecnica.zip';
                                                    break;
                                                }
                                        }
                                        ?>
                                        <div>
                                            <a href="<?php echo $link ?>"><input type="button" class="btn btn-success" value="Download da Documentação"></a>
                                        </div><br/>
                                    <?php } ?>
                                    <div align="center">
                                        <input type="button" class="btn btn-inverse" value="Voltar" onclick="history.go(-1)"/>
                                        <?php if ($_SESSION['usuario']->id_perfil != 3) { ?>
                                            <a href="editar_processo.php?id=<?php echo $processo->id_processo ?>"><input type="button" class="btn btn-success" value="Alterar" /></a>
                                            <?php } ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php
        include_once'bloco/scripts.php';
        ?>
    </body>
</html>